﻿<UserControl
    x:Class="WinRTXamlToolkit.Sample.Views.ImageToggleButtonTestView"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:local="using:WinRTXamlToolkit.Sample.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition
                Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <controls:ImageToggleButton
            Stretch="Fill"
            Width="40"
            Height="35"
            NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
            HoverStateImageSource="ms-appx:///Assets/Images/RedButton_Hover.png"
            PressedStateImageSource="ms-appx:///Assets/Images/RedButton_Pressed.png"
            DisabledStateImageSource="ms-appx:///Assets/Images/RedButton_Disabled.png"
            CheckedStateImageSource="ms-appx:///Assets/Images/GreenButton_Idle.png"
            CheckedHoverStateImageSource="ms-appx:///Assets/Images/GreenButton_Hover.png"
            CheckedPressedStateImageSource="ms-appx:///Assets/Images/GreenButton_Pressed.png"
            CheckedDisabledStateImageSource="ms-appx:///Assets/Images/GreenButton_Disabled.png"
            IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
        <StackPanel
            VerticalAlignment="Center"
            HorizontalAlignment="Center">
            <controls:ImageToggleButton
                HorizontalAlignment="Center"
                NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
                HoverStateImageSource="ms-appx:///Assets/Images/RedButton_Hover.png"
                PressedStateImageSource="ms-appx:///Assets/Images/RedButton_Pressed.png"
                DisabledStateImageSource="ms-appx:///Assets/Images/RedButton_Disabled.png"
                CheckedStateImageSource="ms-appx:///Assets/Images/GreenButton_Idle.png"
                CheckedHoverStateImageSource="ms-appx:///Assets/Images/GreenButton_Hover.png"
                CheckedPressedStateImageSource="ms-appx:///Assets/Images/GreenButton_Pressed.png"
                CheckedDisabledStateImageSource="ms-appx:///Assets/Images/GreenButton_Disabled.png"
                IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
            <TextBlock
                Text="ImageToggleButton with all images set"
                Style="{StaticResource TitleTextStyle}" />
        </StackPanel>

        <StackPanel
            Grid.Column="1"
            VerticalAlignment="Center"
            HorizontalAlignment="Center">
            <controls:ImageToggleButton
                HorizontalAlignment="Center"
                NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
                PressedStateImageSource="ms-appx:///Assets/Images/RedButton_Pressed.png"
                CheckedStateImageSource="ms-appx:///Assets/Images/GreenButton_Idle.png"
                CheckedPressedStateImageSource="ms-appx:///Assets/Images/GreenButton_Pressed.png"
                IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
            <TextBlock
                Text="ImageToggleButton with idle and pressed images set"
                Style="{StaticResource TitleTextStyle}" />
        </StackPanel>

        <StackPanel
            Grid.Row="1"
            VerticalAlignment="Center"
            HorizontalAlignment="Center">
            <controls:ImageToggleButton
                HorizontalAlignment="Center"
                NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
                PressedStateImageSource="ms-appx:///Assets/Images/RedButton_Pressed.png"
                CheckedStateImageSource="ms-appx:///Assets/Images/GreenButton_Idle.png"
                CheckedPressedStateImageSource="ms-appx:///Assets/Images/GreenButton_Pressed.png"
                RecyclePressedStateImageForHover="True"
                IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
            <TextBlock
                Style="{StaticResource TitleTextStyle}"
                TextAlignment="Center">
                <TextBlock.Inlines>
                    <Run
                        Text="ImageToggleButton with idle and pressed images set" />
                    <LineBreak />
                    <Run
                        Text="Hover state images simulated by semi-transparent" />
                    <LineBreak />
                    <Run
                        Text="pressed state images overlaid on top of idle images" />
                </TextBlock.Inlines>
            </TextBlock>
        </StackPanel>

        <StackPanel
            Grid.Column="1"
            Grid.Row="1"
            VerticalAlignment="Center"
            HorizontalAlignment="Center">
            <controls:ImageToggleButton
                HorizontalAlignment="Center"
                NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
                HoverStateImageSource="ms-appx:///Assets/Images/RedButton_Hover.png"
                PressedStateImageSource="ms-appx:///Assets/Images/RedButton_Pressed.png"
                DisabledStateImageSource="ms-appx:///Assets/Images/RedButton_Disabled.png"
                RecycleUncheckedStateImagesForCheckedStates="True"
                IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
            <TextBlock
                Style="{StaticResource TitleTextStyle}"
                TextAlignment="Center">
                <TextBlock.Inlines>
                    <Run
                        Text="ImageToggleButton with all unchecked images set" />
                    <LineBreak />
                    <Run
                        Text="Checked state images simulated by unchecked state images" />
                    <LineBreak />
                    <Run
                        Text="for press-wise reverse states" />
                </TextBlock.Inlines>
            </TextBlock>
        </StackPanel>

        <StackPanel
            Grid.Row="2"
            VerticalAlignment="Center"
            HorizontalAlignment="Center">
            <controls:ImageToggleButton
                HorizontalAlignment="Center"
                NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
                CheckedStateImageSource="ms-appx:///Assets/Images/GreenButton_Idle.png"
                GenerateMissingImages="True"
                IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
            <TextBlock
                Style="{StaticResource TitleTextStyle}"
                TextAlignment="Center">
                <TextBlock.Inlines>
                    <Run
                        Text="ImageToggleButton with idle and checked images set" />
                    <LineBreak />
                    <Run
                        Text="Other state images are generated from these two" />
                </TextBlock.Inlines>
            </TextBlock>
        </StackPanel>

        <StackPanel
            Grid.Column="1"
            Grid.Row="2"
            VerticalAlignment="Center"
            HorizontalAlignment="Center">
            <controls:ImageToggleButton
                HorizontalAlignment="Center"
                NormalStateImageSource="ms-appx:///Assets/Images/RedButton_Idle.png"
                GenerateMissingImages="True"
                IsEnabled="{Binding IsChecked, ElementName=cbIsEnabled}" />
            <TextBlock
                Style="{StaticResource TitleTextStyle}"
                TextAlignment="Center">
                <TextBlock.Inlines>
                    <Run
                        Text="ImageToggleButton with only the idle state image set" />
                    <LineBreak />
                    <Run
                        Text="Other state images are generated from this one" />
                </TextBlock.Inlines>
            </TextBlock>
        </StackPanel>

        <CheckBox
            x:Name="cbIsEnabled"
            Grid.Row="3"
            Margin="0,15"
            Content="IsEnabled"
            IsChecked="True" />
    </Grid>
</UserControl>
